﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TextEditorDP
{
    public class CStatusBar: StatusBar, Widget
    {
        #region Implement Interface
        protected HelpHandler _successor;
        protected string _topic;
        public virtual bool HasHelp()
        {
            if (_topic == "")
                return false;
            return true;
        }

        public virtual void SetHandler(HelpHandler successor, string topic)
        {
            _successor = successor;
            _topic = topic;
        }

        public virtual void HandleHelp()
        {
            if (HasHelp())
            {
                MessageBox.Show(_topic);
            }
            else
            {
                if (_successor != null)
                {
                    _successor.HandleHelp();
                }
            }
        }
        #endregion
    }
}
